package com.zzyk.main.mapper;

import com.zzyk.main.model.vo.WxUser;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

@Component
@Mapper
public interface SysWxUserDao {

    @Select("SELECT * FROM tb_wx_user WHERE MD5(`wx_open_id`) = #{openId}")
    @ResultMap("wxUser")
    public WxUser getUserByOpenId(@Param("openId") String openId);

    @Select("SELECT * FROM tb_wx_user WHERE `user_id` = #{userId}")
    @ResultMap("wxUser")
    public WxUser getUserByUserId(@Param("userId") Integer userId);

    public int addRecord(WxUser wxUser);

    @Delete("DELETE FROM tb_wx_user WHERE `id` = #{id}")
    public int delRecord(@Param("id") int id);

    @Delete("DELETE FROM tb_wx_user WHERE `wx_open_id` = #{openId}")
    public int delWxUserByOpenId(@Param("openId") String openId);
}
